package no.ntnu.fp.gui.listeners;

import no.ntnu.fp.gui.events.CancelMeetingEvent;
import no.ntnu.fp.services.MeetingService;

public class CancelMeetingListener implements GuiListener<CancelMeetingEvent> {
	private final MeetingService meetingService;

	public CancelMeetingListener(MeetingService meetingService) {
		this.meetingService = meetingService;
	}

	@Override
	public void handleEvent(CancelMeetingEvent evt) {
		if(evt.getMeeting().getEmployee().equals(evt.getEmployee())){
			meetingService.deleteMeeting(evt.getMeeting(), evt.getEmployee());
		}else{
			meetingService.rejectMeeting(evt.getMeeting(), evt.getEmployee());
		}
	}

	@Override
	public boolean isLongRunningListener() {
		return false;
	}

}
